package com.example.springbootopenfeign.controller;

import com.example.springbootopenfeign.entity.User;
import com.example.springbootopenfeign.feign.ServiceDemoFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("client")
@Slf4j
public class TestFeignController {

    /**
     * 注入OpenFeign接口
     */
    @Autowired
    private ServiceDemoFeign serviceDemoFeign;

    @GetMapping("getUser")
    public User getUserClient() {
        log.info("开始发送http请求...");
        return serviceDemoFeign.getUser();
    }

    @GetMapping("getHeaderName")
    public String getHeaderName() {
        log.info("开始发送http请求...");
        return serviceDemoFeign.getHeaderName("zzcc");
    }


}
